package com.atguigu.meinian.vo;

import org.apache.poi.ss.formula.functions.T;

import java.io.Serializable;

/**
 * 封装响应结果
 * @author zbystart
 * @create 2021-06-19 11:59
 */
public class R implements Serializable {
    private static final long serialVersionUID = -6849794472354667710L;
    private boolean flag;//执行结果，true为执行成功 false为执行失败
    private String message;//返回结果信息
    private Object data;//返回数据
    public R(boolean flag, String message) {
        super();
        this.flag = flag;
        this.message = message;
    }

    public R(boolean flag, String message, Object data) {
        this.flag = flag;
        this.message = message;
        this.data = data;
    }

    public boolean isFlag() {
        return flag;
    }
    public void setFlag(boolean flag) {
        this.flag = flag;
    }
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public static R ok(String msg, Object data) {
        R r = new R(true, msg, data);
        return r;
    }

    public static R error(String msg) {
        R r = new R(false,msg,null);
        return r;
    }
}
